<template>
  <el-container class="index-con">
    <el-aside :class="showclass">
      <leftnav></leftnav>
    </el-aside>
    <el-container class="main-con">
      <el-header class="index-header">
        <navcon></navcon>
      </el-header>
      <el-main clss="index-main">
        <router-view></router-view>
      </el-main>
    </el-container>
  </el-container>
</template>

<script>
import navcon from '../components/Teachter/navcon'
import leftnav from '../components/Teachter/leftnav'

export default {
  name: 'Teachter',
  data () {
    return {
      showclass: 'asideshow',
      showtype: false
    }
  },
  components: {
    navcon,
    leftnav
  },
  created () {
    // 监听
    this.$root.Bus.$on('toggle', value => {
      if (!value) {
        this.showclass = 'asideshow'
      } else {
        setTimeout(() => {
          this.showclass = 'aside'
        }, 300)
      }
    })
  },
  beforeRouteLeave (to, from, next) {
    if (to.path === '/HomeStudent') {
      next(false)
    } else next()
  },
  methods: {
  }
}
</script>

<style lang="stylus" scoped>
.index-con
  height: 100%
  width: 100%
  box-sizing: border-box
.aside
  width: 64px !important
  height: 100%
  background-color: #334157
  margin: 0px
.el-aside
 box-shadow: 0 0 7px 0 #030303;
.asideshow
  width: 240px !important
  height: 100%
  background-color: #334157
  margin: 0px
.index-header,
.index-main
  padding: 0px;
  border-left: 2px solid #334157
  box-shadow: 0 0 0 2px #5c656e;
 .img_bg
  position : absolute
  width : 46%
  height : 90%
  margin-left : 20.5%
  opacity : 0.25
  z-index : -1
</style>
